# To change this template, choose Tools | Templates
# and open the template in the editor.


#an action is performed by a character on anything object (or non-object)
#on another tile in the level
        
class Action:
    def __init__(self):
        pass

    def perform(self, dat, src, dst):
        return None

class CloseAction(Action):
    def __init(self):
        Action.__init__(self)
        #closed door, open it

    def perform(self, dat, src, dst):
        r = dat.level.close_door(src[0] + dst[0], src[1] + dst[1])
        dat.gui.msg_mgr.add_msg("You close a door. ")
        return r

class PickupAction(Action):
    def __init(self):
        Action.__init__(self)
        #closed door, open it

    def perform(self, dat, src, dst):
        r = dat.level.pickup(src, dst)
        if r is not None:
            for i in r:
                dat.gui.msg_mgr.add_msg("You pick up a {0}. ".format(i.name))

            dat.item_sprites.remove(r)
        else:
            dat.gui.msg_mgr.add_msg("You pick up thin air. ")

        return None

class BumpAction(Action):
    def __init(self):
        Action.__init__(self)
        #closed door, open it

    def perform(self, dat, src, dst):
        dat.gui.msg_mgr.add_msg("You bump into a door (lol). ")
        return None

class CheckAction(Action):
    def __init(self):
        Action.__init__(self)
        #closed door, open it

    def perform(self, dat, src, dst):
        r = dat.level.check(src, dst)
        if r is not None:
            for i in r:
                dat.gui.msg_mgr.add_msg("You see here a {0}. ".format(i.name))
        return None